<!doctype html >
  <head>
    <meta charset="utf-8">
    <title>Health Test</title>
    <link rel="stylesheet" href="app.css">
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
    <!--<script type="text/javascript" src="app.js"></script>-->
  </head>
  <div id="content"></div>
  <button type="submit" id="create_hospital">Create hospital</button>
  <button type="submit" id="load_hospital">Load hospital</button>
  <button type="submit" id="list_hospital">List hospitals</button>
  <button type="submit" id="login">Login</button>
  <button type="submit" id="register">Register</button>
  <script type="text/javascript">
    $(document).ready(function () {
      $("#create_hospital").click(function(){
        $.ajax({
          url    : '/hospital/create',
          method : 'post',
          data   : {
            name:'武昌医院',
            disc:'这是一家很牛逼的医院！'
          }
        }).done(function (data) {
          $('#content').html(data);
        }).fail(function (xhr, err, status) {
          alert('error', xhr.status + ', ' + xhr.responseText);
        });
      });
      $("#load_hospital").click(function(){
        $.ajax({
          url:'/hospital/load/',
          data:{
            hospital_id:1
          }
        }).done(function(data){
          $('#content').html(data);
        }).fail(function (xhr, err, status) {
          alert('error', xhr.status + ', ' + xhr.responseText);
        });
      });
      $("#list_hospital").click(function(){
        $.ajax({
          url:'/hospital/list/'
        }).done(function(data){
          $('#content').html(JSON.stringify(data));
        }).fail(function (xhr, err, status) {
          alert('error', xhr.status + ', ' + xhr.responseText);
        });
      });
      $("#register").click(function(){
        $.ajax({
          url:'/accounts/register/',
          method:'post',
          data:{
            name:'雷英哲5',
            userpassword:'123456',
            wxopen:'khalil-yingzhe'
          }
        }).done(function(data){
          $('#content').html(JSON.stringify(data));
        }).fail(function (xhr, err, status) {
          alert('error', xhr.status + ', ' + xhr.responseText);
        });
      });
      $("#login").click(function(){
        $.ajax({
          url:'/accounts/login/',
          method:'post',
          data:{
            name:'雷英哲5',
            userpassword:'123456',
            wxopen:'khalil-yingzhe'
          }
        }).done(function(data){
          $('#content').html(JSON.stringify(data));
        }).fail(function (xhr, err, status) {
          alert('error', xhr.status + ', ' + xhr.responseText);
        });
      });
    });
  </script>
    <!--<div id="container">-->
      <!--<div id="header">-->
        <!--<h1>AnonTXT! <em>&gt;</em></h1>-->
      <!--</div>-->
      <!--<div id="main">-->
        <!--<div class="alerts"></div>-->
        <!--<section class="latest">-->
          <!--<h3>Latest txts:</h3>-->
          <!--<div class="texts">Loading..</div>-->
        <!--</section>-->
        <!--<section class="new">-->
          <!--<h3>New text:</h3>-->
          <!--<div class="new">-->
            <!--<form action="/messages" method="post">-->
              <!--<div class="errors"></div>-->
              <!--<div class="entry title">-->
                <!--<label>-->
                  <!--<span class="title">Text title</span>-->
                  <!--<input type="text" name="title" />-->
                <!--</label>-->
              <!--</div>-->
              <!--<div class="entry body">-->
                <!--<label>-->
                  <!--<span class="title">Main TeXT</span>-->
                  <!--<textarea name="body"></textarea>-->
              <!--</div>-->
              <!--<button type="submit">Create!</button>-->
            <!--</form>-->
          <!--</div>-->
        <!--</section>-->
      <!--</div>-->
      <!--<div id="footer">-->
        <!--Anon text is 100% fat free!-->
      <!--</div>-->
    <!--</div>-->
  </body>
</html>
